﻿<%@ taglib prefix="page" uri="http://com.qipay/pagelib" %>
<%@ page import="com.qipay.admin.utils.SiteHelper" %>

<%@ page import="com.qipay.scalar.type.ProductTypeEnum" %>
<%@ page import="com.qipay.baas.model.SpRonghuiChannel" %>
<!doctype html>
<html>
<head>
    <jsp:include page="head.jsp"></jsp:include>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <jsp:include page="nav.jsp"></jsp:include>
    <jsp:include page="left.jsp"></jsp:include>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Main content -->
        <% SpRonghuiChannel spRonghuiChannel = (SpRonghuiChannel) request.getAttribute("detail");
           boolean isAdd = String.valueOf(request.getAttribute("isadd")).equals("1");

            //CpInfo cpInfo = (CpInfo)request.getAttribute("detailInfo");
        %>
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box box-info">
                        <% if (request.getParameter("error")!=null){%>
                        <div class="alert alert-error">
                            此入网商户已经包含这种支付方式，请重新选择。
                        </div>
                        <%}%>
                        <div class="box-header with-border">
                            <h3 class="box-title">编辑支付类型信息</h3>
                        </div>
                        <!-- /.box-header -->
                        <!-- form start -->
                        <form class="form-horizontal" action="save" method="POST" id="doc-vld-msg">
                            <input type="hidden" name="spRonghuiMchId" value="<%= isAdd?request.getParameter("spRonghuiMchId"):spRonghuiChannel.getSpRonghuiMchId().toString()%>">
                            <input type="hidden" name="merchantNo" value="<%=request.getParameter("merchantNo")%>">
                            <input type="hidden" name="id" value="<%= isAdd?"":String.valueOf(spRonghuiChannel.getId())%>">
                            <div class="box-body" id="dvContent">
                                <div class="form-group"  style="<%= isAdd?"":"display:none"%>">
                                    <label for="ddltype" class="col-sm-2 control-label">支付方式：</label>
                                    <div class="col-sm-10">
                                        <select id="ddltype" name="productType" >
                                            <% for (ProductTypeEnum productType:ProductTypeEnum.values()) {%>
                                            <option value="<%=productType.getType()%>"><%= productType.getInfo()%>
                                            </option>
                                            <%}%>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="txtt1fee" class="col-sm-2 control-label">t1手续费(单位：%)：</label>

                                    <div class="col-sm-10">
                                        <input type="number" maxlength="3" class="form-control" id="txtt1fee" name="t1fee" mush="1"
                                               value="<%= isAdd?"":spRonghuiChannel.getT1fee()%>" placeholder="支付费率">
                                    </div>
                                </div> <div class="form-group">
                                    <label for="txtt0fee" class="col-sm-2 control-label">t0手续费(单位：%)：</label>
                                    <div class="col-sm-10">
                                        <input type="number" maxlength="3" class="form-control" id="txtt0fee" name="t0fee" mush="1"
                                               value="<%= isAdd?"":spRonghuiChannel.getT0fee()%>" placeholder="支付费率">
                                    </div>
                                </div>

                            </div>
                            <!-- /.box-body -->
                            <div class="box-footer">
                                <button type="button" class="btn btn-default" onclick="window.history.back()">返回
                                </button>
                                <button type="button" class="button back-gray pull-right" id="btnSearch">确 定</button>
                            </div>
                            <!-- /.box-footer -->
                        </form>
                    </div>
                    <!-- /.box -->
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <jsp:include page="foot.jsp"></jsp:include>
</div>
<script type="text/javascript"
        src="<%= request.getAttribute("StaticHost") %>/js/jquery.ajaxfileupload.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/fastclick.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/adminlte.min.js"></script>
<script>
    $(function () {


        $("#btnSearch").on("click", function () {
            var isGo = checkInputMust("dvContent");
            if(isGo) {
                var t0fee = parseInt($("#txtt0fee").val(), 10);
                if (t0fee < 0 || t0fee > 100) {
                    alert("支付费率值要在0-100之间");
                    return;
                } var t1fee = parseInt($("#txtt1fee").val(), 10);
                if (t1fee < 0 || t1fee > 100) {
                    alert("支付费率值要在0-100之间");
                    return;
                }

                console.log($("#doc-vld-msg").serialize());
                $("#doc-vld-msg")[0].submit();
            }
        });

    });

</script>
</body>
</html>

